﻿using System;

namespace kunukn.RecommendationEngine.AreaRecommendation.Code.Entities
{
    /// <summary>
    /// Author: Kunuk Nykjaer
    /// </summary>
    [Serializable]
    public class Item : IComparable
    {
        public const string ItemKey = "item";

        public string Id { get; private set; }
        public string Name { get; set; }
        public string Color { get; set; }

        public Item()
        {
            Id = Guid.NewGuid().ToString();
        }

        protected void Clone(Item item)
        {
            if (item == null)
                return;

            this.Id = item.Id;
            this.Name = item.Name;
            this.Color = item.Color;
        }

        public int CompareTo(object other)
        {
            if (other == null)
            {
                return 1;
            }
                
            return this.Name.CompareTo( ((Item)other).Name);         
        }

        public override string ToString()
        {
            return string.Format("Name: {0}, Color: {1}",Name,Color);            
        }

        public override int GetHashCode()
        {            
            return this.Id.GetHashCode();
        }
    }
}